package com.czkt.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.czkt.pojo.BasDict;
import com.czkt.mapper.BasDictMapper;
import com.czkt.service.IBasDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author baomidou
 * @since 2024-06-19
 */
@Service
public class BasDictServiceImpl extends ServiceImpl<BasDictMapper, BasDict> implements IBasDictService {
    @Autowired
    BasDictMapper basDictMapper;

    @Override
    public IPage<BasDict> selectPage(Page<BasDict> page, BasDict basDict) {
        LambdaQueryWrapper<BasDict> queryWrapper = new QueryWrapper<BasDict>()
                .lambda().eq(basDict.getDictId() >= 0 && basDict.getDictId() != null,BasDict::getDictId,basDict.getDictId())
                .like(BasDict::getDictItem,basDict.getDictItem());
        return basDictMapper.selectPage(page,queryWrapper);
    }
}
